package spe;

import org.eclipse.jdt.ui.JavaUI;
import org.eclipse.ui.IFolderLayout;
import org.eclipse.ui.IPageLayout;
import org.eclipse.ui.IPerspectiveFactory;
import org.eclipse.ui.progress.IProgressConstants;

import spe.ui.wizard.DiagramNewWizard;
import spe.ui.wizard.NewMethodLibraryWizard;
import spe.ui.wizard.SPEProjectNewWizard;


/*
 * 	Author: Dao Anh Vu
 * */

public class Perspective implements IPerspectiveFactory 
{
	public static String PERSPECTIVE_ID = Perspective.class.getName();
	
	public void createInitialLayout(IPageLayout layout) 
	{
		String editorArea = layout.getEditorArea();
		IFolderLayout topLeftFolder = layout.createFolder("topLeft", IPageLayout.LEFT, 0.30f, editorArea);
		topLeftFolder.addView(JavaUI.ID_PACKAGES);
		topLeftFolder.addPlaceholder(JavaUI.ID_TYPE_HIERARCHY);
		topLeftFolder.addPlaceholder(IPageLayout.ID_RES_NAV);
		
		IFolderLayout outputfolder= layout.createFolder("bottom", IPageLayout.BOTTOM, (float)0.70, editorArea); //$NON-NLS-1$
		outputfolder.addView(IPageLayout.ID_PROP_SHEET);
		outputfolder.addPlaceholder(IPageLayout.ID_PROBLEM_VIEW);
		outputfolder.addPlaceholder(JavaUI.ID_JAVADOC_VIEW);
		outputfolder.addPlaceholder(JavaUI.ID_SOURCE_VIEW);
		outputfolder.addPlaceholder("org.eclipse.search.ui.views.SearchView");
		outputfolder.addPlaceholder("org.eclipse.ui.console.ConsoleView");
		outputfolder.addPlaceholder(IPageLayout.ID_BOOKMARKS);
		outputfolder.addPlaceholder(IProgressConstants.PROGRESS_VIEW_ID);
		
		layout.addView(IPageLayout.ID_OUTLINE, IPageLayout.BOTTOM, 0.25f, "left");
		layout.addView("spe.ui.navigator.view", IPageLayout.RIGHT, 0.3f/*IPageLayout.RATIO_MAX*/, IPageLayout.ID_EDITOR_AREA);
		
		layout.addShowViewShortcut(IPageLayout.ID_OUTLINE);
		
		//Add new wizards to sub menu 'New'
		layout.addNewWizardShortcut(SPEProjectNewWizard.ID);
		layout.addNewWizardShortcut(NewMethodLibraryWizard.ID);
		layout.addNewWizardShortcut(DiagramNewWizard.ID);
		//Get the registry
		//IWizardRegistry newWRegistry = PlatformUI.getWorkbench().getNewWizardRegistry();
		//IWizardCategory newWizardCategory = newWRegistry.findCategory("spe.app.newWizard.category");
	}
}
